<%@ page pageEncoding="utf-8" %>
<%@include file="/commons/taglibs.jsp" %>
<!DOCTYPE html>
<html >
<head>
    <meta charset="utf-8">
    <title>拖拖部落商家系统</title>
    <jsp:include page="/WEB-INF/commons/commons-header.jsp" flush="true"/>
    <style>
        html {background:#fff;}
    </style>
</head>

<body >
<div class="layui-container">
<div class="layui-form" lay-filter="layuiadmin-app-form-list" id="layuiadmin-app-form-list" style="padding: 20px 30px 0 0;">

    <form:form commandName="unit" method="${_method }" class="layui-form" id="form">
        <input type="hidden" name="_method" value="${_method }"/>
        <form:hidden path="id"/>
        <div class="layui-form-item">
            <label class="layui-form-label"><b style="color:red">*</b> 单位名称</label>
            <div class="layui-input-block">
                <form:input path="name" class="layui-input" placeholder="单位名称" style="width: 300px;"/>
            </div>
        </div>

        <div class="layui-input-block">
            <div style="display: none"><input type="button" value="保存" class="layui-btn" id="submit" lay-filter="submit" lay-submit></div>
        </div>

    </form:form>
</div>
</div>

<script>
    $(function () {

        layui.use(['form', 'laydate'], function () {

            var form = layui.form;
            var laydate = layui.laydate;

            form.on('submit(submit)', function (data) {

                $("#form").ajaxSubmit({
                    success: function (result) {
                        if (result.status) {
                            var index = parent.layer.getFrameIndex(window.name);
                            parent.layer.close(index);
                            parent.$("#search").click();
                        } else {
                            layui.use('layer', function () {
                                layer.msg(result.message);
                            });
                        }
                    }
                });
            });

        });

    });
</script>
</body>

</html>